load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test", "rust_test_suite")

package(default_visibility = ["//visibility:public"])

DEPENDENCIES = [
    # Keep sorted.
    "//rs/interfaces/registry",
    "//rs/limits",
    "//rs/protobuf",
    "//rs/registry/keys",
    "//rs/registry/proto",
    "//rs/registry/provisional_whitelist",
    "//rs/registry/routing_table",
    "//rs/registry/subnet_features",
    "//rs/types/base_types",
    "//rs/types/management_canister_types",
    "//rs/types/types",
    "@crate_index//:serde_cbor",
    "@crate_index//:thiserror",
]

MACRO_DEPENDENCIES = []

DEV_DEPENDENCIES = [
    # Keep sorted.
    "//rs/registry/fake",
    "//rs/registry/proto_data_provider",
    "@crate_index//:assert_matches",
]

MACRO_DEV_DEPENDENCIES = []

ALIASES = {}

rust_library(
    name = "helpers",
    srcs = glob(["src/**/*.rs"]),
    aliases = ALIASES,
    crate_name = "ic_registry_client_helpers",
    proc_macro_deps = MACRO_DEPENDENCIES,
    version = "0.9.0",
    deps = DEPENDENCIES,
)

rust_test(
    name = "helpers_test",
    aliases = ALIASES,
    crate = ":helpers",
    proc_macro_deps = MACRO_DEPENDENCIES + MACRO_DEV_DEPENDENCIES,
    deps = DEPENDENCIES + DEV_DEPENDENCIES,
)

rust_test_suite(
    name = "helpers_integration",
    srcs = glob(["tests/**/*.rs"]),
    aliases = ALIASES,
    proc_macro_deps = MACRO_DEPENDENCIES + MACRO_DEV_DEPENDENCIES,
    deps = [":helpers"] + DEPENDENCIES + DEV_DEPENDENCIES,
)
